package demo1217.am;

import java.util.Calendar;

/*
时间类:
Calendar抽象类:
获取该Calendar实例的方法:public Calendar getInstance();
常用的方法:
1.public int get(int field);返回给定日历字段的值
常用的字段:
YEAR
WEEK_OF_MONTH
DAY_OF_WEEK_IN_MONTH:
 */
public class Demo_03 {
    public static void main(String[] args) {
        Calendar instance = Calendar.getInstance();
        System.out.println(instance);
        //获取的是该变量实际指向的对象所属类的全称名.
        System.out.println(instance.getClass().getName());
        System.out.println(instance.get(Calendar.YEAR));
        //月份从0开始.
        System.out.println(instance.get(Calendar.MONTH));
        System.out.println(instance.get(Calendar.DATE));
        System.out.println("---------------");
        System.out.println("一年的第"+instance.get(Calendar.DAY_OF_YEAR));
        System.out.println("一个月的第"+instance.get(Calendar.DAY_OF_MONTH));
        System.out.println(""+instance.get(Calendar.DAY_OF_WEEK_IN_MONTH));
        System.out.println(""+instance.get(Calendar.WEEK_OF_MONTH));
    }
}
